<%@tag import="by.epam.communalservices.utils.Staff"%>
<%@tag import="java.sql.Connection"%>
<%@tag import="by.epam.communalservices.entity.JkhWorker"%>
<%@tag import="java.util.List"%>

<%@ attribute name="name" required="true"%>
<%@ attribute name="attr"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>


<select name="${name}" ${attr}>
	<OPTION VALUE='0'>
		<c:out value="добавить свободного" />
	</OPTION>
	<%
	    Staff staff = new Staff((Connection) request.getSession().getAttribute("currentConnection"));
	    List<JkhWorker> workerList = staff.getFreeWorker();

	    for (JkhWorker item : workerList) {
	        out.println("<OPTION VALUE='" + item.getId() + "'>" + item.getId().toString() + ". " + item.getName() + " "
	                + item.getPatronymic() + "</OPTION>");
	    }
	%>

</select>
